import React from 'react';
import DataTable from 'components/DataTable';
import Icon from 'components/Icon';
import Button from 'components/Button';
import { Link } from 'dva/router';

export default (self, category) => [
  {
    title: '工厂名',
    name: 'name',
    tableItem: {},
    formItem: {},
    searchItem: {}
  },
  {
    title: '工厂联系方式',
    name: 'contact',
    tableItem: {},
    formItem: {},
    searchItem: {}
  },
  {
    title: '工厂地址',
    name: 'origin',
    tableItem: {},
    formItem: {},
    searchItem: {}
  },
  {
    title: '工厂描述',
    name: 'desciption',
    tableItem: {},
    formItem: {},
    searchItem: {}
  },
  {
    title: '操作',
    tableItem: {
      width: 180,
      render: (text, record) => (
        <DataTable.Oper>
          <Button tooltip="修改" onClick={e => self.onUpdate(record)}>
            <Icon type="edit" />
          </Button>
          <Button tooltip="删除" onClick={e => self.onDelete(record)}>
            <Icon type="trash" />
          </Button>
          <Button tooltip="跳转到新路由">
            <Link to={"/crud/detail?id=" + record.id}>
              <Icon type="link" antd />
            </Link>
          </Button>
        </DataTable.Oper>
      )
    }
  }
];
